<?php
class tpl_admin_helperlist {
	function call ($toObj) {
		$toObj->text('');
		$toObj->DOG_appendChild('h2')->text('ヘルパー一覧');

		$Field = $toObj->DOG_appendChild('fieldset');
		$Field->DOG_appendChild ('legend')->text('ヘルパー一覧');

		$Field->DOG_appendChild ('div')->addClass('information')->text('ヘルパーを選択、操作します。');

		$Table = $Field->DOG_appendChild('table');
		
		$TR = $Table->DOG_appendChild('thead')->DOG_appendChild('tr');
		
		$TR->DOG_appendChild('th')->text('ヘルパー名');
		$TR->DOG_appendChild('th')->text('パス');
//		$TR->DOG_appendChild('th')->text('バージョン');
//		$TR->DOG_appendChild('th')->text('説明');
		$TR->DOG_appendChild('th')->text('操作');


		$Tbody = $Table->DOG_appendChild('tbody');

		$HelperList = array();
		$List = array_merge(scandir (DIR_BASE_SYS. '/helpers/extend'), scandir (DIR_BASE_SYS. '/helpers/default'));
		foreach ($List as $Helper) {
			if (preg_match('/hlp(.*)/', $Helper, $matches)) {
				if (array_search($Helper, $HelperList)) continue;
				$HelperList[] = $Helper;

				$TR = $Tbody->DOG_appendChild('tr');
	
				$TR->DOG_appendChild('td')->text($matches[1]);
				$TR->DOG_appendChild('td')->text(substr(Y('Helper.Path', $matches[1]), strlen(dirname(DIR_BASE_SYS))));
//				$TR->DOG_appendChild('td')->text($Val['version']);
//				$TR->DOG_appendChild('td')->text($Val['description']);
	
				$Act = $TR->DOG_appendChild('td');
				if (file_exists(Y('Helper.Path', $matches[1]).'/readme.txt')) {
					$Act->DOG_appendChild('a')->attr(array('href'=>Y('Route.Path').'/yfwsys/helperreadme/'.$matches[1]))->text('README')->DOG_appendChild('br');
				} else {
					$Act->text('-')->DOG_appendChild('br');
				}
//				$Act->DOG_appendChild('a')->attr(array('href'=>Y('Route.Path').'/yfwsys/moduleinstall/'.$Key))->text('Install')->DOG_appendChild('br');
//				$Act->DOG_appendChild('a')->attr(array('href'=>Y('Route.Path').'/yfwsys/modulehelp/'.$Key))->text('Help')->DOG_appendChild('br');
			} else {
				continue;
			}
		}

		return true;

	}
}
?>